/************************************************************
 * Project Name         [Thinking_In_Java]
 * File Name            [Example_01_Resource.java]
 * Creation Date        [24-Jun-2014]
 * 
 * Copyright© ge.y.yang@gmail.com All Rights Reserved
 * 
 * Work hard, play harder, think big and keep fit
 ************************************************************/
package pkg_03_miscellaneous;

import java.io.InputStream;
import java.net.URL;
import java.util.Scanner;

/**
 * 获取资源文件信息
 * 
 * @author 不落的太阳(Sean Yang)
 * @version 1.0
 * @since JDK 6
 * 
 */
public class Example_01_Resource {

	@SuppressWarnings("unused")
	public static void main(String[] args) {
		// getResource()方法用于获取图像和音频资源
		URL titleURL = Example_01_Resource.class
				.getResource("../pkg_resources/title.gif");

		// getResourceAsStream()方法用于读取文件中的数据
		InputStream input = Example_01_Resource.class
				.getResourceAsStream("../pkg_resources/title.txt");
		Scanner scanner = new Scanner(input);
		System.out.println(scanner.nextLine());
		scanner.close();
	}

}
